package com.study.d019fxml;

import java.net.URL;

import com.study.d019fxml.control.HelloControl;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

/**FXML的使用
*@description
*@author xtayhame
*date 2020年3月16日
*version
*since v1.0
*/
public class HelloFxmlMain2 extends Application{
	public static void main(String[] args) {
		launch(args);
	}
	@Override
	public void start(Stage stage) throws Exception {
		FXMLLoader fx = new FXMLLoader();
		URL url=fx.getClassLoader().getResource("com/study/d019fxml/xmls/hello2.fxml");
		AnchorPane anchorPane =(AnchorPane)FXMLLoader.load(url);
		stage.setScene(new Scene(anchorPane, 300, 400));
		stage.show();

		//获取对应的Control
		HelloControl control=(HelloControl)fx.getController();

		//通过控制器来获取控制器内的方法，对象 和属性
		/*control.getClickBtn();
		control.getTitleLabel();*/

	}

}
